//
//  WeHomePageRecommendedFooterView.m
//  WeGalaxy
//
//  Created by Zheng on 2017/7/19.
//  Copyright © 2017年 Zheng. All rights reserved.
//

#import "WeHomePageRecommendedFooterView.h"

@interface WeHomePageRecommendedFooterView ()

@end

@implementation WeHomePageRecommendedFooterView

#pragma mark -
- (BOOL)touchesShouldCancelInContentView:(UIView *)view {
    return YES;
}

#pragma mark - 点击事件
- (void)btnClickAction:(UIButton *)sender {
    NSLog(@"%ld",sender.tag);
    
    _footerClickBlock(sender.tag-17000);
}

#pragma mark - 设置row数量
- (void)rowsForFooterView:(NSInteger)rows {
    
    self.contentSize = CGSizeMake((6+165)*rows+6, 65);
    
    for (int i = 0; i < rows; i++) {
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.layer.backgroundColor = [[UIColor orangeColor] CGColor];
        btn.layer.borderWidth = 1;
        btn.layer.borderColor = [[UIColor grayColor] CGColor];
        [btn addTarget:self action:@selector(btnClickAction:) forControlEvents:UIControlEventTouchUpInside];
        btn.frame = (CGRect){165*i+6*(i+1),20,165,65};
        btn.tag = 17000+i;
        [self addSubview:btn];
    }
}


#pragma mark - 初始化
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (!self) return nil;
    
    self.showsVerticalScrollIndicator = NO;
    self.showsHorizontalScrollIndicator = NO;
    
    UIView *lineView = [[UIView alloc] initWithFrame:CGRectMake(0, 105, kSCREEN_WIDTH, 0.75)];
    lineView.backgroundColor = kRGB_COLOR(228, 227, 229, 1);
    [self addSubview:lineView];

    return self;
}




@end
